<template>
  <div class="info">
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="用户名">
        <el-input v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.password" type="password"></el-input>
      </el-form-item>
      <el-form-item label="目标院校">
        <el-input v-model="form.tschool"></el-input>
      </el-form-item>
      <el-form-item label="邮箱">
        <el-input v-model="form.email"></el-input>
      </el-form-item>
      <el-form-item label="QQ号码">
        <el-input v-model="form.qq"></el-input>
      </el-form-item>
      <el-form-item label="手机号">
        <el-input v-model="form.telphone"></el-input>
      </el-form-item>
      <el-radio-group v-model="form.sex">
        <el-radio label="男"></el-radio>
        <el-radio label="女"></el-radio>
      </el-radio-group>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </el-form>
  </div>
</template>

<script>
import { userCenterInfo, userone } from "../api/myReq";
export default {
  name: "userEdit",
  data() {
    return {
      form: {},
      radio: "",
    };
  },
  methods: {
    onSubmit() {
      userCenterInfo(this.form).then((resp) => {
        this.$message({
          message: resp.data.message,
          duration: 2000,
          type: "success",
        });
      });
    },
  },
  created() {
    // this.form = JSON.parse(this.$route.query.id);
    userone(this.$route.query.id).then((resp) => {
      console.log(resp);
      this.form = resp.data.data[0];
    });
  },
};
</script>

<style scoped>
.info {
  margin: 0 auto;
  width: 1000px;
}
.el-radio-group{
  display: block;
}
</style>